﻿<!-- 工作量-初始化,生成上课信息 -->
<template>


    <div>

        <!-- 添加按钮 -->
        <div class="btn-add">
            <button type="button" class="btn btn-success btn-lg" @click="drjh()"><i class="iconfont icon-dc ft12 mr5"></i>计划导入</button>
            <button type="button" class="btn btn-danger btn-lg" @click="deljh()"><i class="iconfont icon-dc ft12 mr5"></i>删除计划</button>

        </div>
        <!-- 按条件选择 -->



        <div class="tab-filter-type ">

            <div class="col-xs-8 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-default  dropdown-toggle">专业信息</button>
                    </div>
                    <span style="line-height: 34px;margin-left: 5px;font-weight: BOLDER;">{{zydata.nj}}级-{{zydata.zymc}}-学制{{zydata.xz}}年</span>
                </div>
            </div>
            <div class="col-xs-2 padding20 hide">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-default  dropdown-toggle">学期</button>
                    </div>
                    <el-select placeholder="学期" size="mini" v-model="query.xq" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="一学期" value="0"></el-option>
                        <el-option label="二学期" value="1"></el-option>

                    </el-select>

                </div>
            </div>
        </div>

        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px">


            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>
        </div>
        <!-- 表格 -->



    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {
                zydata: {},
                query: {
                    nj: "2020",
                    zydm: "540501",
                    xz: "3",
                    xq: "",
                },
                tableop: {
                    title: "教学计划信息",
                    issel: true,
                    iscz: false,
                    height: 500,
                    isxh: true,
                    loading: true,
                    dataset: [],
                    multipleSelection: [],
                    collist: [
                        { colid: "kcmc", colname: "课程名称", isshow: true, istip: true,width:180 },
                        { colid: "lbdh", colname: "课程类别代码", isshow: true, istip: true },
                        { colid: "kcdm", colname: "课程代码", isshow: true, istip: true },
                        { colid: "ksfs", colname: "考核方式", isshow: true, istip: true },
                        { colid: "xq", colname: "开课学期", isshow: true, istip: true },
                        { colid: "zxs", colname: "周学时", isshow: true, istip: true },
                        { colid: "xs", colname: "学时", isshow: true, istip: true },
                        { colid: "xf", colname: "学分", isshow: true, istip: true },
                        { colid: "shjxs", colname: "实践学时", isshow: true, istip: true },
                        { colid: "sjxs", colname: "上机周学时", isshow: true, istip: true },
                        { colid: "zc1", colname: "起始周", isshow: true, istip: true },
                        { colid: "zc2", colname: "结束周", isshow: true, istip: true },
                        { colid: "zyfx", colname: "专业方向", isshow: true, istip: true },
                        { colid: "kcxbmc", colname: "开课院系", isshow: true, istip: true }
                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            drjh: function () {
                var pro = this;
                var url = 'http://jw.yyvtc.cn/web_jxjh/web_jxjh_load_jys.aspx?nj=' + pro.zydata.nj + "&zydm=" + pro.zydata.zydm + "&xz=" + pro.zydata.xz;
                ComFunJS.winviewform(url, '培养方案导入', '', '')
            },
            deljh: function () {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop.multipleSelection.length; i++) {
                    ids.push(this.tableop.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                pro.tableop.loading = true;
                $.getJSON('/API/VIEWAPI.ashx?Action=JXJH_DELJXJH', { nj: pro.zydata.nj, zydm: pro.zydata.zydm, xz: pro.zydata.xz, ids: ids.join() }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.loading = false;
                        pro.querydata();

                    }
                })

            },
            querydata: function () {
                var pro = this;
                pro.tableop.loading = true;
                $.getJSON('/API/VIEWAPI.ashx?Action=JXJH_GETJXJH', { nj: pro.zydata.nj, zydm: pro.zydata.zydm, xz: pro.zydata.xz }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.dataset = resultData.Result;
                        pro.tableop.loading = false;
                    }
                })

            },

            InitWigetData: function () {
                this.querydata();
            },
        },
        watch: {
            'query': { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    var chi = this;
                    if (newV) {
                        chi.querydata();
                    }
                },
                deep: true
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.zydata = JSON.parse(JSON.stringify(pro.$root.pagedata.ExtData));
                pro.InitWigetData();
            })

        }
    };
</script>